package com.hopes.bizz.close.statistic.controller;

import com.hopes.bizz.close.statistic.dto.AlarmChartDTO;
import com.hopes.bizz.close.statistic.service.ClosedAlarmStatisticService;
import com.hopes.boss.common.core.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

/**
 * @author yumr
 * @ProjectName bizz
 * @Description 危险品车辆报警统计
 * @time 2024/2/11 22:14
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/statistic")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class ClosedAlarmStatisticController {


    private final ClosedAlarmStatisticService closedAlarmStatisticService;


    @Operation(summary = "危险品车辆报警统计图表", description = "危险品车辆报警统计图表")
    @PostMapping("/hazardCarAlarmChart")
    public R queryHazardCarAlarmChart(@RequestBody AlarmChartDTO alarmChartDTO) {
        final String endTime = alarmChartDTO.getEndTime();
        final String startTime = alarmChartDTO.getStartTime();
        final Integer alarmType = alarmChartDTO.getAlarmType();
        return R.ok(closedAlarmStatisticService.queryAlarmChart(alarmType, startTime, endTime));
    }

}
